<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/search.js"></script>
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			$('#btn-export').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.fm.csv.value="download";
					document.fm.submit();
				}
			});
			$('#btn-exporta').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.fm.csv.value="downloada";
					document.fm.submit();
					
				}
			});
			$('#btn-reset').click(function(){	
				location.href = document.fm.action;
			});
			
			$('#btn_search').click(function(){	
				document.fm.csv.value="";
				document.fm.submit();
			});
		});
		function toPage(thepage) {
			document.fm.page.value =  thepage;
			document.fm.csv.value="";
			document.fm.submit();
		}

		function setSS( valcd, valnm ) {
			if (gPara == "shop") {
				document.fm.shop_cd.value = valcd;
				document.fm.shop_name.value = valnm;			
			}
			if (gPara == "mediaid") {
				document.fm.media_cd.value = valcd;
				document.fm.media_name.value = valnm;			
			} 
			$('#dialog').dialog("close");
		}
		</script>
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />
		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
	</head>
	<body id="">
{{$menu}}
{{$logout}}
		<div id="container"><div class="wrapper">
			<h2>折込販売店マスター管理</h2>
			<ul class="submenu clearfix">
				<li>折込販売店情報一覧</li>
				{{ if (!$isG4) && (!$isG5) }} <li><a href="minsshop_form.php">折込販売店情報登録</a></li>{{ /if }}
				<li><a href="minsshop_import.php">CSV更新</a></li>
				{{ if  (!$isG5) }} <li><a href="mins_delive_index.php">納品先マスタ</a></li>{{ /if }}
			</ul>
			<h3>折込販売店情報一覧</h3>
			<form name="fm" id="fm" method="get" action="minsshop_index.php" >
				<input type="hidden" name="page" />
				<table class="formTable">
					<tbody>
						<tr>
							<th>折込会社</th>
							<td>
{{ if ($isG4) }} 
							<input type="text " name="ins_co_name"  class="dtext" value="{{ $forms.ins_co_name }}"  readonly/>
							<input type="hidden" name="ins_co_cd" value="{{ $forms.ins_co_cd }}" />
{{ else }}
							{{ html_options id='ins_co_cd' name='ins_co_cd' options=$ins_co selected=$forms.ins_co_cd }}
{{ /if }}
							</td>
						</tr>
						<tr>
							<th>ブロック</th>
							<td>
{{ html_options id='block_cd' name='block_cd' options=$block selected=$forms.block_cd }}
							</td>
						</tr>
						<tr>
							<th>都道府県</th>
							<td>
{{ html_options id='local_cd' name='local_cd'  options=$local selected=$forms.local_cd }}
								<input type="hidden" name="local_name" value="{{ $forms.local_name }}" />
							</td>
						</tr>
						<tr>
							<th>媒体名</th>
							<td>
								<input type="text" name="media_name" class="text" value="{{ $forms.media_name }}" />
								<input type="hidden" name="media_cd"  value="{{ $forms.media_cd|escape }}" />
								<button type="button" id="mediaid" class="btn_search" rel="media"><span>参照</span></button>
							</td>
						</tr>
						<tr>
							<th>GEOコード</th>
							<td>
								<input type="text" name="ins_shop_cd" value="{{ $forms.ins_shop_cd }}" class="text" />
							</td>
						</tr>
						<tr>
							<th>販売店名</th>
							<td>
								<input type="text" name="ins_shop_name" value="{{ $forms.ins_shop_name }}" class="text" />
							</td>
						</tr>
						<tr>
							<th>地域広告有無</th>
							<td>
{{ html_options id='area_pattern_cd' name='area_pattern_cd'  options=$pattern selected=$forms.area_pattern_cd }}
								
							</td>
						</tr>
						<tr>
							<th>廃止設定</th>
							<td>
								{{ html_radios name='stopflg' options=$stopflags selected=$forms.stopflg separator='&nbsp;' }}
							</td>
						</tr>
						<tr>
							<th>更新日</th>
							<td>
								<input type="text" name="upd_f" class="text_date" value="{{ $forms.upd_f }}" /> ～ 
								<input type="text" name="upd_t" class="text_date" value="{{ $forms.upd_t }}" />
							</td>
						</tr>
					</tbody>
				</table>
				<p class="button" style="text-align:right">
					<button type="button" id="btn-reset"><span>クリア</span></button>
					<button type="button" id="btn_search" class="submit"><span>絞込検索</span></button>
				</p>
				<input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
			</form>
{{ if is_numeric($page.cnt) }}
{{ if $page.cnt > 0 }}
			<p class="message">{{ $page.cnt }}件の情報が見つかりました。</p>
			<p align="left">{{$pageing}}</p>
			<table id="search_result" class="sortable">
				<thead>
					<tr>
					{{ if  (!$isG5) }}
						<th><h3>廃止済</h3></th>
						<th><h3>折込会社</h3></th>
					{{ /if }}
						<th><h3>GEOコード</br>販売店名</h3></th>
						<th><h3>都道府県</br>ブロック </h3></th>
						<th><h3>媒体名</h3></th>
					{{ if  (!$isG5) }}
						<th><h3>折込会社部数</h3></th>
					{{ /if }}
					{{ if  (!$isG4) }}
						<th><h3>地域広告有無</h3></th>
						<th><h3>地域広告部数</h3></th>
						<th><h3>地域広告備考</h3></th>
					{{ /if }}
					{{ if  (!$isG5) && (!$isG4) }}
						<th><h3>店舗名</br>店舗からの距離</h3></th>
					{{ /if }}
						<th><h3>更新日時</br>更新者</h3></th>
						<th><h3>操作</h3></th>
					</tr>
				</thead>
				<tbody>
{{ if  (!$isG5) && (!$isG4) }}
{{ foreach from=$data key=k item=v name="member" }}
					<tr class="{{cycle values=odd,mod name='member'}}">
						<td>{{ $v.stop }}</td>
						<td>{{ $v.ins_co_name }}</td>
						<td>{{ $v.ins_shop_cd }}</br>{{ $v.ins_shop_name }}</td>
						<td>{{ $v.local_name}}</br>{{ $v.block_name }}</td>
						<td>{{ $v.media_name }}</td>
						<td align="right">{{ $v.insert_conums|number_format }}</td>
						<td>{{ $v.pattern_name }}</td>
						<td align="right">{{ $v.area_adnums|number_format }}</td>
						<td >{{ $v.area_memo }}</td>
						<td>{{ $v.shop }}</br>[{{$v.aoki_compete}}]{{ $v.shop_away }}</td>
						<td class="center">{{ $v.u_time|date_format:"%Y/%m/%d %H:%M" }}</br>{{ $v.m_user_name }}</td>
						<td class="center"><a href="minsshop_form.php?id={{ $v.id }}">[更新]</a></td>
					</tr>
{{ /foreach }}
{{ /if }}
{{ if   ($isG4) }}
{{ foreach from=$data key=k item=v name="member" }}
					<tr class="{{cycle values=odd,mod name='member'}}">
						<td>{{ $v.stop }}</td>
						<td>{{ $v.ins_co_name }}</td>
						<td>{{ $v.ins_shop_cd }}</br>{{ $v.ins_shop_name }}</td>
						<td>{{ $v.local_name}}</br>{{ $v.block_name }}</td>
						<td>{{ $v.media_name }}</td>
						<td align="right">{{ $v.insert_conums|number_format }}</td>
						<td class="center">{{ $v.u_time|date_format:"%Y/%m/%d %H:%M" }}</br>{{ $v.m_user_name }}</td>
						<td class="center"><a href="minsshop_form.php?id={{ $v.id }}">[更新]</a></td>
					</tr>
{{ /foreach }}
{{ /if }}
{{ if  ($isG5)  }}
{{ foreach from=$data key=k item=v name="member" }}
					<tr class="{{cycle values=odd,mod name='member'}}">
						<td>{{ $v.ins_shop_cd }}</br>{{ $v.ins_shop_name }}</td>
						<td>{{ $v.local_name}}</br>{{ $v.block_name }}</td>
						<td>{{ $v.media_name }}</td>
						<td>{{ $v.pattern_name }}</td>
						<td align="right">{{ $v.area_adnums|number_format }}</td>
						<td >{{ $v.area_memo }}</td>
						<td class="center">{{ $v.u_time|date_format:"%Y/%m/%d %H:%M" }}</br>{{ $v.m_user_name }}</td>
						<td class="center"><a href="minsshop_form.php?id={{ $v.id }}">[更新]</a></td>
					</tr>
{{ /foreach }}
{{ /if }}
				</tbody>
			</table>
			<p align="right">{{$pageing}}</p>
				<p class="button">
					<button type="button" id="btn-export"  ><span>CSVダウンロード</span></button>
					<!--  <button type="button" id="btn-exporta"  ><span>地域広告CSV</span></button>-->
				</p>
{{ else }}
<p class="message">条件にマッチする情報は見つかりませんでした。</p>
{{ /if }}
{{ else }}
	<p class="message">ここに検索結果が表示されます。</p>
{{ /if }}
<div id="dialog" >
</div>
		</div></div>
		{{ $footer }}
	</body>
</html>